<?php
/**
 * Created by Chongyi.
 * Date: 2015/10/15 0015
 * Time: 下午 3:48
 */

namespace App\B2BProject\Support;

use Illuminate\Http\Request;
use Illuminate\Pagination\Paginator;
use Illuminate\Pagination\AbstractPaginator;
use Illuminate\Support\ServiceProvider;

class PaginationProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @param Request $request
     *
     * @return void
     */
    public function boot(Request $request)
    {
        if ($request->is('admin/*')) {
            // 使用自定义分页模板
            Paginator::presenter(function (AbstractPaginator $paginator) {
                return new AmazeUIPaginationPresenter($paginator);
            });
        }
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}